<?php
/**
 *
 * @Author nikm $
 *
 * @Date 2011-12-23 $
 */

if(!defined('FROM_INDEX')) exit('Invalid request');

require ROOT_PATH.'servlet/module/master.mod.php';

class moduleObj extends masterObj
{
	function __construct($request)
	{
		parent::__construct($request);
		
		$this->excute();
	}
	
	function excute()
	{
		switch($this->act)
		{
			case 'list':
				$this->getReferList();
				break;
			default:
				$this->message('004', STATUS_E);
		}
		
		$this->showResponse();
	}
	
	/**
	 * 
	 * Get movie refer list
	 */
	function getReferList()
	{
		$this->_checkUser();
		
		if(!isset($this->request['moveId']))
		{
			$this->message('005', STATUS_E);
		}
		
		$request['from_id'] = $this->from_id;
		$request['to_id'] = $this->to_id;
		$request['page_limit'] = $this->page_limit;
		$request['page_num'] = $this->page_num;
		$request['movie_id'] = $this->request['moveId'];
		
		$results = get_movie_refer_list($request);
		
		$movie_refer_list = array();
		
		if(check_array($results))
		{
			foreach($results as $item)
			{
				$movie_refer_list[] = $item['refer'];
			}
		}
		
		$this->response['status'] = STATUS_S;
		$this->response['count'] = (string)count($movie_refer_list);
		$this->response['quotesList'] = $movie_refer_list;
	}
}